package com.cf.user.core.part.wx;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * wx-hongbao-WxSmallAppProperty
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/1/16 9:55
 */
@Configuration
@ConfigurationProperties(prefix = "cf.xcx")
public class WxSmallAppProperty {

    private String appId;

    private String secret;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public String getUserOpenIdUrl(String jsCode) {
        return "https://api.weixin.qq.com/sns/jscode2session?appid=" + appId + "&secret=" + secret + "&js_code=" + jsCode + "&grant_type=authorization_code";
    }

    public String getUserAccessTokenUrl() {
        return "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + this.secret;
    }

    public String getUserInfoUrl(String accesstoken, String openId) {
        return "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + accesstoken + "&openid=" + openId;
    }


}

